<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<?php $this->layout = FALSE?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Registration</title>
        <link href="<?php echo Yii::app()->baseUrl."/assets/css/bootstrap.min.css" ?>" rel="stylesheet" />	
        <link href="<?php echo Yii::app()->baseUrl."/assets/css/font-awesome.min.css" ?>" rel="stylesheet" />
        <link rel="stylesheet" href="<?php echo Yii::app()->baseUrl?>/assets/css/bootstrapValidator.min.css"/>
        
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl?>/assets/js/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl."/assets/js/bootstrap.min.js" ?>"></script>
        <script type="text/javascript" src="<?php echo Yii::app()->baseUrl?>/assets/js/bootstrapValidator.min.js"></script>
        
        
    </head>
    <body>
        <div class="container">
            <div class="page-header">
                <ol class="breadcrumb">
                    <li><a href="..">Home</a></li>
                    <li class="active">Registration</li>
                </ol>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading"><h3>Đăng ký</h3> hoặc <a href="../site/login">Đăng nhập</a></div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-8 col-lg-offset-2">
                                                                                                                       
                                                         
                            <form id ="registrationForm" method="post" action="" class="form-horizontal">
                                 <?php $form=$this->beginWidget('CActiveForm');?>
                                <?php echo $form->error($model,'username');?>      
                                <div class="form-group">
                                    <label class="col-lg-3 control-label">You Name</label>
                                    <div class="col-lg-5">
                                        <input type="text" class="form-control" name="RegisterForm[name]" placeholder="Họ Tên"/>
                                    </div>                                    
                                </div>        
                                
                                <div class="form-group">
                                    <label class="col-lg-3 control-label">Email</label>
                                    <div class="col-lg-5">
                                        <input type="text" class="form-control" name="RegisterForm[email]" placeholder="Địa chỉ Email"/>
                                    </div>
                                </div>
                                
                                <div class="form-group">
                                    <label class="col-lg-3 control-label">Username</label>
                                    <div class="col-lg-5">
                                        <input type="text" class="form-control" name="RegisterForm[username]" placeholder="Tên đăng nhập"/>
                                    </div>
                                </div>
                                
                                <div class="form-group">
                                    <label class="col-lg-3 control-label">Password</label>
                                    <div class="col-lg-5">
                                        <input type="password" class="form-control" id="password" name="RegisterForm[password]" placeholder="Mật khẩu"/>
                                    </div>
                                </div>
                                
                                <div class="form-group">
                                    <label class="col-lg-3 control-label">Repeat Password</label>
                                    <div class="col-lg-5">
                                        <input type="password" class="form-control" name="RegisterForm[cpassword]" placeholder="Nhập lại mật khẩu"
                                               />
                                       
                                    </div>
                                </div>
                                
                                <div class="form-group">
                                    <label class="col-lg-3 control-label">Mobile/Phone</label>
                                    <div class="col-lg-5">
                                        <input type="text" class="form-control" name="RegisterForm[mobile]" placeholder="Số điện thoại"/>
                                    </div>
                                </div>
                                
                                <div class="form-group">
                                    
                                        <label class="col-lg-3 control-label"></label>
                                        <div class="col-lg-5">
                                        <input type="checkbox" class="checkbox-inline" name="RegisterForm[accept]"/>
                                        <span class="inline">I accept the <a href="#">User Agreement</a></span>
                                           </div>
                                </div>
                                
                                <!--<div class="margin-10"></div>-->
                                <div class="form-group">
                                    <div class="col-lg-9 col-lg-offset-3">
                                        <!-- Do NOT use name="submit" or id="submit" for the Submit button -->
                                        <button type="reset" class="btn btn-info"><span class="icon-refresh"></span> Reset</button>
                                        <button type="submit" name="register" class="btn btn-success">Sign up <span class="icon-arrow-right"></span></button>
                                    </div>
                                </div>
                                                            <?php $this->endWidget(); ?>

                            </form>
                            
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script type="text/javascript">
        $(document).ready(function (){
            $("#registrationForm").bootstrapValidator({
                feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            'RegisterForm[username]': {
                message: 'The username is not valid',
                validators: {
                    notEmpty: {
                        message: 'The username is required and cannot be empty'
                    },
                    stringLength: {
                        min: 6,
                        max: 30,
                        message: 'The username must be more than 6 and less than 30 characters long'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9]+$/,
                        message: 'The username can only consist of alphabetical and number'
                    },
                    different: {
                        field: 'RegisterForm[password]',
                        message: 'The username and password cannot be the same as each other'
                    }
                }
            },
             'RegisterForm[email]': {
                validators: {
                    notEmpty: {
                        message: 'The email address is required and cannot be empty'
                    },
                    emailAddress: {
                        message: 'The email address is not a valid'
                    }
                }
            },
             'RegisterForm[password]': {
                validators: {
                    notEmpty: {
                        message: 'The password is required and cannot be empty'
                    },
                    different: {
                        field: 'RegisterForm[username]',
                        message: 'The password cannot be the same as username'
                    },
                    stringLength: {
                        min: 6,
                        message: 'The password must have at least 6 characters'
                    }
                }
            },
            'RegisterForm[cpassword]': {
                validators: {
                    notEmpty: {
                        message: 'The password is required and cannot be empty'
                    },
                    identical: {
                        field: 'RegisterForm[password]',
                        message: 'The password and its confirm are not the same'
                    },
                }
            },
            'RegisterForm[name]': {
                message: 'The name is not valid',
                validators: {
                    notEmpty: {
                        message: 'The name is required and cannot be empty'
                    },
                    stringLength: {
                        min: 6,
                        max: 30,
                        message: 'The username must be more than 6 and less than 30 characters long'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9]+$/,
                        message: 'The username can only consist of alphabetical and number'
                    },
                    different: {
                        field: 'RegisterForm[password]',
                        message: 'The username and password cannot be the same as each other'
                    }
                }
            },
            'RegisterForm[mobile]': {
                message: 'The mobile is not valid',
                validators: {
                    notEmpty: {
                        message: 'The mobile is required and cannot be empty'
                    },
                    stringLength: {
                        min: 6,
                        max: 30,
                        message: 'The mobile must be more than 6 and less than 30 characters long'
                    },
                    digits: {
                        message: 'The phone number can contain digits only'
                    },
                }
            },
            'RegisterForm[accept]':{
                messages: 'The License is not valid',
                validators: {
                    notEmpty: {
                        messages: 'The license is required'
                    }
                }
            }
        }
            })
    })
        </script>
    </body>
</html>
